package com.itheima.springbootwebtlias.mapper;

import com.itheima.springbootwebtlias.pojo.EmpQueryParam;
import com.itheima.springbootwebtlias.pojo.Student;
import com.itheima.springbootwebtlias.pojo.StudentQueryParam;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

@Mapper
public interface StudentMapper {

    //班级列表查询
    List <Student> selectByCondition(StudentQueryParam queryParam);

    //学院查询
    @Select("select * from student")
    List<Student> selectAll();


    //添加学员 xml
    void insert(Student student);

    //批量删除
    void deleteBatchById(List<Integer> ids);

    //修改学员
    void update(Student student);

    //根据id查询学员
    @Select("select * from student where id=#{id}")
    Student selectById(Integer id);

    //学员统计
    @MapKey("name")
    List<Map> studentCount();

    //学历统计
    @MapKey("name")
    List<Map> degreeCount();

    @Select("select count(*) from student where clazz_id = #{id}")
    Integer selectByStudentId(Integer id);
}
